Imaging apparatus and its control method

ABSTRACT

An imaging apparatus includes an imaging plane phase-difference type first focus detecting unit and a contrast type second focus detecting unit. A saturation detecting unit detects saturation of focus detecting pixels or imaging pixels provided in an imaging element. A brightness detecting unit detects the brightness of an object. If the number of pixels detected by the saturation detecting unit exceeds a predetermined value or the brightness of an object detected by the brightness detecting unit is less than a predetermined value, a CPU controls a focus adjustment operation only using a first detection amount. Alternatively, the CPU controls a focus adjustment operation based on the result obtained by weighting processing of a first detection amount and a second detection amount in response to an increase in the number of pixels of which saturation of the outputs has been detected or a decrease in the brightness of an object.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of application Ser. No. 14/589,357,filed Jan. 5, 2015 the entire disclosure of which is hereby incorporatedby reference.

BACKGROUND OF THE INVENTION

Field of the Invention

The present invention relates to an imaging apparatus and its controlmethod, and particularly relates to auto focus (hereinafter abbreviatedas “AF”) control based on a photoelectric conversion signal output froman imaging element.

Description of the Related Art

One focus detection method performed by an imaging apparatus is animaging plane phase-difference type method that detects a focus stateusing focus detecting pixels formed in an imaging element. Another focusdetection method performed by an imaging apparatus is a contrast typemethod that detects a focus state using a contrast evaluation valuebased on a shot imaging signal output from an imaging element.

Japanese Patent Laid-Open No. 2013-25246 discloses an imaging planephase-difference type imaging apparatus that includes a contrastevaluating unit and a correlation calculating unit and compares twoabsolute values of focus evaluation ranges obtained from these units tothereby determine the focus evaluation value of an object by thecomparison result. The contrast evaluating unit determines a contrastfocus position based on the contrast evaluation value of a signalobtained by shift summation of imaging signals from different pupilareas. Thus, a focus position can be specified without actually drivinga focus lens for AF control.

However, Japanese Patent Laid-Open No. 2013-25246 does not disclose anyconcrete solution against a low-brightness object which isdisadvantageous for the contrast evaluating unit as compared with thecorrelation calculating unit and the result evaluation under asaturation condition. Thus, it may become difficult to perform shootingin an in-focus state if focus detection cannot be performed by thecontrast evaluating unit.

SUMMARY OF THE INVENTION

The present invention provides an imaging apparatus that can detect afocus state with accuracy under the condition of shooting alow-brightness object or the condition including a saturated pixel andits control method.

According to an aspect of the present invention, an imaging apparatus isprovided that includes an imaging element having a plurality of focusdetecting pixels for receiving light passing through different partialpupil areas of an focusing optical system; a control unit configured tocontrol a focus adjustment operation using detection signals from theplurality of focus detecting pixels; a signal generating unit configuredto generate a plurality of focus detection signals from signals receivedby the plurality of focus detecting pixels; a first focus detecting unitconfigured to calculate a correlation amount by performing first filterprocessing and first shift processing to the plurality of focusdetection signals and output a signal of a first detection amountobtained from the correlation amount; a second focus detecting unitconfigured to calculate a contrast evaluation value by generating ashift summation signal obtained by the summation of second filterprocessing and second shift processing to the plurality of focusdetection signals and output a signal of a second detection amountobtained from the contrast evaluation value; and a saturation detectingunit configured to detect saturation of the outputs of the plurality offocus detecting pixels or a brightness detecting unit configured todetect the brightness of an object from an image captured by the imagingelement.

In the imaging apparatus according to a first aspect of the presentinvention, if the number of focus detecting pixels of which thesaturation detecting unit detects the saturation of the outputs exceedsa threshold value, the control unit controls a focus adjustmentoperation using the first detection amount, whereas if the number offocus detecting pixels of which the saturation detecting unit detectsthe saturation of the outputs is equal to or less than a thresholdvalue, the control unit controls a focus adjustment operation using thefirst detection amount and the second detection amount.

In the imaging apparatus according to a second aspect of the presentinvention, the control unit calculates a third detection amount byperforming a weighting processing of the first detection amount and thesecond detection amount using a weighted coefficient determined from thenumber of pixels in which saturation of the outputs of imaging pixelsincluding the plurality of focus detecting pixels or the plurality offocus detecting pixels has been detected by the saturation detectingunit and controls the focus adjustment operation using the thirddetection amount.

In the imaging apparatus according to a third aspect of the presentinvention, if the brightness level detected by the brightness detectingunit is less than a threshold value, the control unit controls a focusadjustment operation using the first detection amount, whereas if thebrightness level detected by the brightness detecting unit is equal toor greater than a threshold value, the control unit controls a focusadjustment operation using the first detection amount and the seconddetection amount.

In the imaging apparatus according to a fourth aspect of the presentinvention, the control unit calculates a third detection amount byperforming a weighting processing of the first detection amount and thesecond detection amount using a weighted coefficient determined from thebrightness of an object detected by the brightness detecting unit andcontrols the focus adjustment operation using the third detectionamount.

According to the present invention, a focus state can be detected withaccuracy under the condition of shooting a low-brightness object or thecondition including a saturated pixel.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic block view illustrating an example of aconfiguration of an imaging apparatus in order to explain a firstembodiment of the present invention in conjunction with FIGS. 2 to 18.

FIG. 2 is a schematic view illustrating the pixel array of an imagingelement.

FIG. 3A is a schematic plan view illustrating a pixel.

FIG. 3B is a schematic cross-sectional view illustrating a pixel.

FIG. 4 is a schematic view illustrating the relationship between a pixeland pupil division.

FIG. 5A is a schematic explanatory view illustrating an imaging elementand pupil division.

FIG. 5B is a schematic view illustrating the relationship between thedefocus amount between a first focus detection signal and a second focusdetection signal and the image shift amount therebetween.

FIG. 6 is a flowchart illustrating first focus detection processing.

FIGS. 7A to 70 are schematic explanatory views each illustrating shadingcaused by a pupil shift between a first focus detection signal and asecond focus detection signal.

FIG. 8 is a graph illustrating a filter frequency band.

FIG. 9A is a graph illustrating the first and second focus detectionsignals.

FIG. 9B is a graph illustrating the first and second focus detectionsignals obtained after optical correction processing and first filterprocessing.

FIG. 10 is a graph illustrating an exemplary calculation of first andsecond detection defocus amounts.

FIG. 11 is a schematic explanatory view illustrating refocus processing.

FIG. 12 is a flowchart illustrating second focus detection processing.

FIG. 13A is a graph illustrating the first and second focus detectionsignals obtained after second filter processing.

FIG. 13B is a graph illustrating a signal obtained after shift summationof the first and second focus detection signals obtained after secondfilter processing.

FIG. 14 is a graph illustrating a second evaluation value.

FIG. 15 is a schematic explanatory view illustrating a refocusablerange.

FIGS. 16A to 16C are schematic views each illustrating the differencebetween second detection defocus amounts due to presence/absence of asaturated signal.

FIG. 17 is a flowchart illustrating focus detection processingcorresponding to the number of lines including a saturated signal.

FIG. 18 is a flowchart illustrating focus detection processingcorresponding to a brightness level.

FIG. 19 is a flowchart illustrating focus detection processingcorresponding to the number of lines including a saturated signal inorder to explain a second embodiment of the present invention inconjunction with FIG. 20.

FIG. 20 is a flowchart illustrating focus detection processingcorresponding to a brightness level.

DESCRIPTION OF THE EMBODIMENTS

Hereinafter, preferred embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.

First Embodiment

FIG. 1 is a block view illustrating an example of a configuration of animaging apparatus according to a first embodiment of the presentinvention. A first lens group 101 which is arranged at the distal end ofthe imaging optical system (focusing optical system) is held so as to beextendable and retractable in the optical axis direction in the lensbarrel. An aperture shutter 102 adjusts the aperture diameter to adjustthe light quantity when shooting. The aperture shutter 102 alsofunctions as a shutter for adjusting the exposure time when shooting astill image. The aperture shutter 102 and a second lens group 103advance and retract together in the optical axis direction to achieve azooming operation (zooming function) in synchronism with the reciprocaloperation of the first lens group 101. A third lens group 105 is a focuslens for focusing by advancing and retracting in the optical axisdirection. An optical low-pass filter 106 is an optical element forreducing the false color or moiré of a shot image. An imaging element107 consists of a two-dimensional CMOS (Complementary Metal OxideSemiconductor) photo sensor and its peripheral circuit and is arrangedon the imaging surface of the imaging optical system.

A zoom actuator 111 performs the zooming operation by rotating a camcylinder (not shown) to cause the first lens group 101 and the secondlens group 103 to move in the optical axis direction. Anaperture/shutter actuator 112 controls the aperture diameter of theaperture shutter 102 to adjust the light quantity when shooting, andcontrols the exposure time when shooting a still image. A focus actuator114 performs the focus adjustment operation by moving the third lensgroup 105 in the optical axis direction.

An electronic flash 115 is used to illuminate an object when shooting.The electronic flash 115 is preferably a flash illumination device usinga xenon tube but may also be an illumination device having a continuousemission LED (Light Emitting Diode). An AF auxiliary light source 116improves the focus detection capability for a low-brightness object orlow-contrast object. The AF auxiliary light source 116 projects an imageof a mask having a predetermined aperture pattern to the field via aprojection lens.

A CPU (Central Processing Unit) 121 which constitutes the control unitof a camera system has a control central function which carries out thevarious types of control. The CPU 121 includes an arithmetic unit, a ROM(Read Only Memory), a RAM (Random Access Memory), an A (Analog)/D(digital) converter, a D/A converter, a communication interface circuit,and the like. The CPU 121 drives various circuits incorporated in thecamera on the basis of a predetermined program stored in the ROM toexecute a series of operations including AF control, shooting, imageprocessing, record processing, and the like. The CPU 121 also has asaturation detecting unit 1211 and a brightness detecting unit 1212which are realized by executing a control program. The saturationdetecting unit 1211 detects the saturation state of the brightnessoutputs of the pixel signals acquired by the imaging element 107. Thebrightness detecting unit 1212 detects the brightness of an object, anda brightness detection signal is used for determination upon AF control.

An electronic flash control circuit 122 controls the ON operation of theelectronic flash 115 in synchronism with the shooting operation inaccordance with the control command of the CPU 121. An auxiliary lightsource driving circuit 123 controls the ON operation of the AF auxiliarylight unit 116 in synchronism with the focus detection operation inaccordance with the control command of the CPU 121. An imaging elementdriving circuit 124 controls the imaging operation of the imagingelement 107, A/D-converts an acquired imaging signal, and transits thedigital data to the CPU 121. An image processing circuit 125 performsprocesses such as γ conversion, color interpolation, JPEG (JointPhotographic Experts Group) compression, and the like for an imageobtained by the imaging element 107.

A focus driving circuit 126 carries out control to drive the focusactuator 114 on the basis of the focus detection result in accordancewith the control command of the CPU 121, and move the third lens group105 in the optical axis direction, thereby adjusting the focus. Anaperture/shutter driving circuit 128 carries out control to drive theaperture/shutter actuator 112 in accordance with the control command ofthe CPU 121, whereby the diameter of the aperture shutter 102 iscontrolled. A zoom driving circuit 129 drives the zoom actuator 111 inaccordance with the zooming operation instruction of the photographer inaccordance with the control command of the CPU 121.

A display unit 131 has a display device such as an LCD (Liquid CrystalDisplay) or the like, and displays information on the shooting mode ofthe camera, a preview image before shooting, a confirmation image aftershooting, an in-focus display image upon focus detection, and the like.An operation unit 132 includes a power switch, release (shootingtrigger) switch, zooming operation switch, shooting mode selectionswitch, and the like as operation switches and outputs an operationinstruction signal to the CPU 121. A flash memory 133 is a storagemedium removable from a camera main body and records shot image data orthe like.

Next, a description will be given of an array of imaging pixels andfocus detecting pixels formed on an imaging element according to thepresent embodiment with reference to FIG. 2. FIG. 2 illustrates animaging pixel array of a two-dimensional CMOS sensor (imaging element)in a 4-column by 4-row range, and a focus detecting pixel array in an8-column by 4-row range. A 2-column by 2-row pixel group 200 includes aset of pixels 200R, 200G, and 200B to be described below.

Pixel 200R (see upper left position): a pixel having a spectralsensitivity of R (Red).

Pixels 200G (see upper right and lower left positions): pixels having aspectral sensitivity of G (Green).

Pixel 200B (see lower right position): a pixel having a spectralsensitivity of B (Blue).

Each pixel is constituted by a first focus detecting pixel 201 and asecond focus detecting pixel 202 which are arranged in a 2-column by1-row array. The 4-column by 4-row pixels (8-column by 4-row focusdetecting pixels) shown in FIG. 2 is arranged in plural in a gridpattern on a plane, so that captured imaging signals and focus detectionsignals can be acquired. In the imaging element described in the presentembodiment, a pixel cycle P=4 (μm) and the number of pixels N is 5,575horizontal columns by 3,725 vertical rows (about 20,750 thousandpixels). The cycle of focus detecting pixels in the column directionP_(AF)=2 (μm) and the number of focus detection pixels N_(AF) is 11,150horizontal columns by 3,725 vertical rows (about 41,500 thousandpixels).

FIG. 3A shows a plane view of a pixel 200G of the imaging element shownin FIG. 2 as viewed from the light-receiving surface side (+z side) ofthe imaging element. The z-axis is set in a direction vertical to thesheet of FIG. 3A, and the direction toward the user is defined as thepositive direction of the z-axis. The y-axis is set in a verticaldirection orthogonal to the z-axis and the upward direction is definedas the positive direction of the y-axis. The x-axis is set in ahorizontal direction orthogonal to the z-axis and the y-axis and therightward direction is defined as the positive direction of the x-axis.FIG. 3B shows a cross-sectional view along a cut line a-a in FIG. 3A asviewed from −y side.

As shown in FIG. 3B, a microlens 305 for collecting incident light isformed on the light-receiving surface side (+z direction) of each pixeland the pixel 200G includes a plurality of divided photoelectricconversion units. For example, the number of division in the x-directionis defined as N_(H) and the number of division in the y-direction isdefined as N_(V). FIGS. 3A and 3B show an example in which a pupil areais divided into two areas in the horizontal direction, i.e., the casewhere N_(H)=2 and N_(V)=1, where a photoelectric conversion unit 301 anda photoelectric conversion unit 302 are formed as sub-pixels. Thephotoelectric conversion unit 301 corresponds to the first focusdetecting pixel 201, and the photoelectric conversion unit 302corresponds to the second focus detecting pixel 202. The photoelectricconversion units 301 and 302 are formed as pin structure photodiodeswith an intrinsic layer interposed between a p-type layer 300 and ann-type layer. The photoelectric conversion units 301 and 302 may also beformed as pn junction photodiodes while omitting an intrinsic layer asnecessary. In each pixel, a color filter 306 is provided between themicrolens 305 and both of the photoelectric conversion unit 301 and thephotoelectric conversion unit 302. As necessary, the spectrumtransmissivity of the color filter 306 may be changed for eachsub-pixel, or the color filter may be omitted.

Light incident on the pixel 200G is gathered by the microlens 305,dispersed by the color filter 306, and then received by thephotoelectric conversion unit 301 and the photoelectric conversion unit302. In the photoelectric conversion unit 301 and the photoelectricconversion unit 302, an electron and a hole (positive hole) aregenerated through pair production according to a light-receiving amountand separated by a depletion layer, and thereafter, electrons having anegative charge are accumulated in an n-type layer (not shown). On theother hand, holes are discharged outside the imaging element through ap-type layer connected to a constant voltage source (not shown).Electrons accumulated in the n-type layer (not shown) of thephotoelectric conversion unit 301 and the photoelectric conversion unit302 are transferred to a capacitance unit (FD) via a transfer gate andthen converted into a voltage signal.

FIG. 4 is a schematic explanatory view illustrating the correspondencerelationship between the pixel structure and the pupil division. FIG. 4shows a cross-sectional view of an a-a cross-sectional surface of thepixel structure shown in FIG. 3A as viewed from a +y side and an exitpupil plane (see the exit pupil 400) of the focusing optical system asviewed from a −z side. In FIG. 4, in order to correspond to a coordinateaxis of the exit pupil plane, the x and y axes in the cross-sectionalview are reversed with respect to FIGS. 3A and 3B. By the microlens 305,a first partial pupil area 501 corresponding to the first focusdetecting pixel 201 has a substantially conjugating relationship withthe light-receiving surface of the photoelectric conversion unit 301 ofwhich the center of gravity is biased to the −x direction. In otherwords, the first partial pupil area 501 represents a pupil area that canreceive light over the first focus detecting pixel 201 and of which thecenter of gravity is eccentric in the +x direction on the pupil plane.By the microlens 305, a second partial pupil area 502 corresponding tothe second focus detecting pixel 202 has a substantially conjugatingrelationship with the light-receiving surface of the photoelectricconversion unit 302 of which the center of gravity is eccentric in the+x direction. In other words, the second partial pupil area 502represents a pupil area that can receive light over the second focusdetecting pixel 202 and of which the center of gravity is biased to the−x direction on the pupil plane.

A pupil area 500 shown in FIG. 4 is such a pupil area that can receivelight over the entire pixel 200G when all the photoelectric conversionunit 301 and the photoelectric conversion unit 302 (the first focusdetecting pixel 201 and the second focus detecting pixel 202) arecombined together. A correspondence relationship between the imagingelement and the pupil division is shown in the schematic view in FIG.5A. Light passing through the different partial pupil areas of the firstpartial pupil area 501 and the second partial pupil area 502 is incidenton the pixels of the imaging element at different angles. Incident lightis received by the photoelectric conversion unit 301 of the first focusdetecting pixel 201 and the photoelectric conversion unit 302 of thesecond focus detecting pixel 202 which are divided into N_(H) (=2)×N_(V)(=1) and is photoelectrically converted thereby.

As described above, the imaging element 107 according to the presentembodiment includes a first focus detecting pixel for receiving lightpassing through a first partial pupil area of the focusing opticalsystem and a second focus detecting pixel for receiving light passingthrough a second partial pupil area, which is different from the firstpartial pupil area, of the focusing optical system. An imaging pixel forreceiving light passing through the combined pupil area of the firstpartial pupil area and the second partial pupil area of the focusingoptical system is arranged in a two-dimensional plural array. In otherwords, each imaging pixel is constituted by the first focus detectingpixel and the second focus detecting pixel. Note that, if required, theimaging pixel may be configured independently of the first focusdetecting pixel and the second focus detecting pixel such that the firstfocus detecting pixel and the second focus detecting pixel are partiallyin a dispersed arrangement in an imaging pixel array.

The light-receiving signals of the first focus detecting pixels 201 ofpixels in the imaging element are aggregated to thereby generate a firstfocus detection signal and the light-receiving signals of the secondfocus detecting pixels 202 of pixels of the imaging element areaggregated to thereby generate a second focus detection signal. Uponfocus detection, the processing for calculating the image shift amountfrom the first focus detection signal and the second focus detectionsignal is performed. When the output signal of the first focus detectingpixel 201 and the output signal of the second focus detecting pixel 202are summed for each pixel of the imaging element, an imaging signalhaving a resolution corresponding to the number of effective pixels N isgenerated. In this manner, captured image data can be acquired.

Next, a description will be given of the relationship between thedefocus amount between the first focus detection signal and the secondfocus detection signal acquired by the imaging element 107 and the imageshift amount therebetween. FIG. 5B is a schematic view illustrating therelationship between the defocus amount between the first focusdetection signal and the second focus detection signal and the imageshift amount between the first focus detection signal and the secondfocus detection signal. The imaging element (not shown) is disposed onan imaging plane 800, and as in FIGS. 4 and 5A, the exit pupil of thefocusing optical system is divided into the first partial pupil area 501and the second partial pupil area 502.

In a defocus amount d, a distance from the imaging position of an objectimage to the imaging plane 800 is denoted by a magnitude |d|. Thedefocus amount d is defined such that a front focus state in which theimaging position of the object image is on the object side of theimaging plane 800 is negative (d<0), and a rear focus state in which theimaging position of the object image is on the opposite side of theimaging plane 800 is positive (d>0). A focus state in which the imagingposition of the object image is on the imaging plane (in-focus position)is d=0. In FIG. 5B, the position of an object 801 shows a positioncorresponding to the in-focus state (d=0), and the position of an object802 shows a position corresponding to the front focus state (d<0).Hereinafter, the front focus state (d<0) and the rear focus state (d>0)are collectively referred to as a defocus state (|d|>0).

In the front focus state (d<0), light passed through the first partialpupil area 501 (or the second partial pupil area 502) among light fromthe object 802 is temporarily converged, and then spreads with the widthΓ1 (or β2) about a position G1 (or G2) of the center of gravity of thelight. In this case, a blurred image is formed on the imaging plane 800.The blurred image is light-received by the first focus detecting pixel201 (or the second focus detecting pixel 202) constituting each pixelarranged on the imaging element to thereby generate a first focusdetection signal (or second focus detection signal). Thus, the firstfocus detection signal (or second focus detection signal) is detected asan object image (blurred image) having the width Γ1 (or Γ2) at theposition G1 (or G2) of the center of gravity on the imaging plane 800.The width Γ1 (or Γ2) of the object image increases substantially inproportion to an increase in the magnitude |d| of the defocus amount d.Likewise, if the image shift amount of the object image between thefirst focus detection signal and the second focus detection signal isdenoted by “p”, the magnitude |p| thereof increases with an increase inthe magnitude |d| of the defocus amount d. For example, the image shiftamount p is defined as the difference “G1-G2” between the positions G1and G2 of the center of gravity of the light, and the magnitude |p|thereof increases substantially in proportion to an increase in |d|. Inthe rear focus state (d>0), although the image shift direction of theobject image between the first focus detection signal and the secondfocus detection signal is opposite to that in the front focus state, themagnitude |p| similarly increases.

As described above, the magnitude of the image shift amount between thefirst focus detection signal and the second focus detection signalincreases with an increase in the magnitude of the defocus amountbetween the first focus detection signal and the second focus detectionsignal or the magnitude of the defocus amount of an imaging signalobtained by the summation of the first focus detection signal and thesecond focus detection signal.

In the present embodiment, first focus detection of the phase differencetype and second focus detection of the type (hereinafter referred to as“refocus type”) based on a refocus principle are performed using therelationship between the defocus amount d and the image shift amount pbetween the first focus detection signal and the second focus detectionsignal. Basically, first focus detection is used to perform focusadjustment in the range from the first state (large-defocus state with alarge-defocus amount) to the second state (small-defocus state with asmall-defocus amount). Furthermore, second focus detection is used toperform focus adjustment in the range from the small-defocus state to athird state (state near the best in-focus position). A sequence of focusdetection under the condition (condition including saturated pixels orlow brightness condition) where the second focus detection exhibitslower in-focus accuracy than that of the first focus detection will bedescribed below.

Firstly, a description will be given of first focus detection of animaging plane phase-difference type. In the first focus detection, thefollowing processing is executed.

(1) Computation processing for calculating a correlation amount (firstevaluation value) representing a degree of match between the first focusdetection signal and the second focus detection signal by relativelyshifting the signals.

(2) Processing for calculating the image shift amount from a shiftamount at which a correlation amount (a degree of match between signals)increases.

(3) Processing for converting the image shift amount into a firstdetection defocus amount using the relationship in which the magnitudeof the image shift amount between the first focus detection signal andthe second focus detection signal increases with an increase in themagnitude of the defocus amount of the imaging signal. Hereinafter, thefirst detection defocus amount is referred to as the first detectionamount and is denoted by Deft.

FIG. 6 is a flowchart schematically illustrating the flow of first focusdetection processing. The processing is performed by a focus detectionsignal generating unit which is realized by controlling the imagingelement 107 and the image processing circuit 125 in accordance with theprogram executed by the CPU 121.

In step S110, the processing for setting a focus detection area isperformed for focus adjustment within an effective pixel area of theimaging element 107. In the focus detection area, the focus detectionsignal generating unit generates a first focus detection signal from thelight-receiving signal (image-A signal) of the first focus detectingpixel, and generates a second focus detection signal from thelight-receiving signal (image-B signal) of the second focus detectingpixel. In step S120, summation processing for summing three pixels inthe column direction for each of the first focus detection signal andthe second focus detection signal is performed in order to suppress thesignal data amount. Furthermore, the Bayer (RGB) summation processing isperformed for converting an RGB signal into a brightness signal (signalY). These two summation processings are combinedly referred to as “firstpixel summation processing”. In step S130, shading correction processing(optical correction processing) is performed for each of the first focusdetection signal and the second focus detection signal.

A description will be given of shading caused by a pupil shift betweenthe first focus detection signal and the second focus detection signalwith reference to FIGS. 7A to 7C. Each of FIGS. 7A to 7C illustrates therelationship between the first partial pupil area 501 of the first focusdetecting pixel 201 and the second partial pupil area 502 of the secondfocus detecting pixel 202 at the peripheral image height of the imagingelement and an exit pupil 400 of the focusing optical system.

FIG. 7A shows the case where the exit pupil distance Dl of the focusingoptical system is the same as the set pupil distance Ds of the imagingelement. In this case, the exit pupil 400 of the focusing optical systemis substantially evenly pupil-divided by the first partial pupil area501 and the second partial pupil area 502. In contrast, FIG. 7B showsthe case where the exit pupil distance Dl of the focusing optical systemis shorter than the set pupil distance Ds of the imaging element. Inthis case, a pupil shift occurs between the exit pupil of the focusingoptical system and the entrance pupil of the imaging element at theperipheral image height of the imaging element, so that the exit pupil400 of the focusing optical system is unevenly pupil-divided. FIG. 7Cshows the case where the exit pupil distance Dl of the focusing opticalsystem is longer than the set pupil distance Ds of the imaging element.In this case, a pupil shift occurs between the exit pupil of thefocusing optical system and the entrance pupil of the imaging element atthe peripheral image height of the imaging element, so that the exitpupil 400 of the focusing optical system is unevenly pupil-divided.Uneven pupil division occurs at the peripheral image height, so that theintensity of the first focus detection signal and the second focusdetection signal becomes uneven. Consequently, shading occurs such thatan intensity of one of the first focus detection signal and the secondfocus detection signal becomes relatively larger than that of the otherone.

In step S130 in FIG. 6, a shading correction coefficient is determinedbased on the image height of the focus detection area, the F-number ofthe imaging lens (focusing optical system), and the exit pupil distance.In other words, a first shading correction coefficient and a secondshading correction coefficient are generated for the first focusdetection signal and the second focus detection signal, respectively.The shading correction processing is executed by multiplying the firstshading correction coefficient by the first focus detection signal andby multiplying the second shading correction coefficient by the secondfocus detection signal.

In the first focus detection of the phase difference type, firstdetection amount detection processing is performed based on acorrelation (a degree of match between signals) of the first focusdetection signal with the second focus detection signal. If shadingoccurs due to a pupil shift, a correlation (a degree of match betweensignals) of the first focus detection signal with the second focusdetection signal may decrease. In the first focus detection of the phasedifference type, a correlation (a degree of match between signals) ofthe first focus detection signal with the second focus detection signalcan be improved by the shading correction processing, resulting inimproved focus detection performance.

In step S140 in FIG. 6, the first filter processing is performed for thefirst focus detection signal and the second focus detection signal. Thepassband of the first filter processing is illustrated in the graph gashown by the solid line in FIG. 8. A space frequency (line·space/mm) isplotted on the horizontal axis, and a gain is plotted on the verticalaxis with its maximum value set as 1. In the present embodiment, sincefocus detection in a large-defocus state is performed by the first focusdetection of the phase difference type, the filter is configured suchthat the passband of the first filter processing includes a lowfrequency band. Upon focus adjustment from a large-defocus state to asmall-defocus state, the passband of the first filter processing uponfirst focus detection may be adjusted to a higher frequency band asshown in the graph gb shown by the chain-dotted line in FIG. 8 inaccordance with the defocus state. Such band filter characteristics areadjusted for a condition including a saturated signal to be describedbelow, so that the effect of improving the accuracy of the firstdetection amount (Def1) by the first focus detection is obtained.

Next, the first shift processing for relatively shifting the first focusdetection signal and the second focus detection signal obtained afterthe first filter processing in the pupil division direction is performedin step S150 in FIG. 6. A correlation amount (first evaluation value)representing a degree of match between the first focus detection signaland the second focus detection signal is calculated by the first shiftprocessing. The kth first focus detection signal obtained after thefirst filter processing is denoted by A(k) and the kth second focusdetection signal obtained after the first filter processing is denotedby B(k). The range of the number k corresponding to the focus detectionarea is denoted by W. Given that the shift amount by the first shiftprocessing is denoted by s₁ and its range (shift range) is denoted byΓ1, a correlation amount (first evaluation value) COR is calculated byFormula (1):

$\begin{matrix}\left\lbrack {{Formula}\mspace{14mu} 1} \right\rbrack & \; \\{{{{COR}\left( s_{1} \right)} = {\sum\limits_{k \in W}^{\;}\;{{{A(k)} - {B\left( {k - s_{1}} \right)}}}}},{s_{1} \in {\Gamma 1}}} & (1)\end{matrix}$

As a result of the first shift processing by the shift amount s₁, ashift subtraction signal is generated by correspondingly subtracting the“k−s₁”th second focus detection signal B(k−s₁) from the kth first focusdetection signal A(k). An absolute value of the generated shiftsubtraction signal is calculated, and a summation from the number 1 tothe number k in the range W corresponding to the focus detection area,so that a correlation amount (first evaluation value) COR (s₁) can becalculated. If required, a correlation amount (first evaluation value)calculated for each row may be summed over a plurality of rows for eachshift amount.

In step S160, the processing for calculating a real value shift amountby which the correlation amount becomes a minimum value is executed bysub-pixel computation based on the correlation amount (first evaluationvalue) calculated in step S150 to thereby calculate an image shiftamount p1. The image shift amount p1 is multiplied by the firstconversion coefficient K1 corresponding to the image height of the focusdetection area, the F-number of the imaging lens (focusing opticalsystem), and the exit pupil distance to thereby calculate the firstdetection amount (Def1).

As described above, in the first focus detection of the phase differencetype, a correlation amount is calculated by performing the first filterprocessing and the first shift processing for the first focus detectionsignal and the second focus detection signal to thereby detect a firstdetection amount from the correlation amount.

In the imaging element, light received by the focus detecting pixels(first focus detecting pixel and second focus detecting pixel) isdifferent from light received by the imaging pixel, so that the focusdetecting pixel and the imaging signal may be differently affected bythe aberrations (spherical aberration, astigmatism, coma aberration, andthe like) of the focusing optical system. The difference increases witha decrease (bright) in the F-number of the focusing optical system.Thus, when the F-number of the focusing optical system is small(bright), a difference may occur between the detected in-focus positioncalculated by the first focus detection of the phase difference type,i.e., a position where the first detection amount becomes 0 and the bestin-focus position of the imaging signal. The best in-focus position ofthe imaging signal corresponds to the peak position of the MTF(Modulation Transfer Function) for the imaging signal. Thus, inparticular, if the F-number of the focusing optical system is equal toor less than a predetermined value, the focus detection accuracy of thefirst focus detection of the phase difference type may be deteriorated.

FIG. 9A illustrates a first focus detection signal (broken line) and asecond focus detection signal (solid line) at the best in-focus positionof the imaging signal at the peripheral image height of the imagingelement. A pixel address corresponding to a pixel position is plotted onthe horizontal axis and a signal level is plotted on the vertical axis.FIG. 9A shows an example in which the shape of the first focus detectionsignal is different from that of the second focus detection signal dueto the respective aberrations of the focusing optical system. FIG. 9Billustrates a first focus detection signal (broken line) and a secondfocus detection signal (solid line) obtained after the shadingcorrection processing and the first filter processing. This exampleshows a case where the image shift amount p1 between the first focusdetection signal and the second focus detection signal is not zero atthe best in-focus position of the imaging signal. In this case, adifference occurs between the detected in-focus position calculated bythe first focus detection of the phase difference type and the bestin-focus position of the imaging signal.

FIG. 10 illustrates a first detection amount (see the graph g1 shown bya broken line) by the first focus detection of the phase differencetype. A set defocus amount (unit: mm) is plotted on the horizontal axisand a detection defocus amount (unit: mm) is plotted on the verticalaxis. A chain-dotted line shows a graph obtained when the set defocusamount is directly proportional to the detection defocus amount in theproportion of 1:1. The first focus detection signal and the second focusdetection signal shown in FIG. 9A are the first focus detection signaland the second focus detection signal when the set defocus amount is 0in FIG. 10. In the example shown in FIG. 10, the first detection amountby the first focus detection has an offset of about 50 μm (micrometer)on the rear focus side at the best in-focus position where the setdefocus amount is 0 (see Δdef). In other words, it can be seen that thedifference of about 50 μm occurs between the best in-focus position andthe detected in-focus position calculated by the first focus detection.Highly-accurate focus detection can be achieved by suppressing thedifference between the detected in-focus position calculated by thefocus detection signal and the best in-focus position of the imagingsignal. For that purpose, the second focus detection of the refocus typewhich can achieve highly-accurate focus detection in the vicinity of thebest in-focus position of the focusing optical system is performed inaddition to the first focus detection of the phase difference type.

Hereinafter, a description will be given of the second focus detectionof the refocus type according to the present embodiment. In the secondfocus detection of the refocus type, the first focus detection signaland the second focus detection signal are summed by relatively shiftingthe signals to thereby generate a shift summation signal (refocussignal). The MTF peak position of the imaging signal is calculated byusing a contrast evaluation value calculated from the generated refocussignal to thereby calculate a second detection defocus amount.Hereinafter, the second detection defocus amount is referred to as thesecond detection amount and is denoted by Def2.

FIG. 11 is an explanatory view schematically illustrating refocusprocessing in the one-dimensional direction (column direction orhorizontal direction) using the first focus detection signal and thesecond focus detection signal. The imaging plane 800 shown in FIG. 11corresponds to the imaging plane 800 shown in FIGS. 5A and 5B. FIG. 11schematically shows the ith pixel in the column direction of the imagingelement disposed on the imaging plane 800, where the symbol i is aninteger variable. A first focus detection signal obtained by the ithpixel is denoted by A_(i), and a second focus detection signal obtainedby the ith pixel is denoted by B_(i). The first focus detection signalA_(i) is a light-receiving signal of light incident on the ith pixel atthe chief ray angle θa (corresponding to the first partial pupil area501 shown in FIGS. 5A and 5B). The second focus detection signal B_(i)is a light-receiving signal of light incident on the ith pixel at thechief ray angle θb (corresponding to the second partial pupil area 502shown in FIGS. 5A and 5B).

Each of the first focus detection signal A_(i) and the second focusdetection signal B_(i) has not only light intensity distributioninformation but also incident angle information. The refocus signal canbe generated on a virtual imaging surface 810 in accordance with thefollowing translational movement and summation processing.

Processing for translationally moving the first focus detection signalA_(i) to the virtual imaging surface 810 along the direction of theangle θa and for translationally moving the second focus detectionsignal B_(i) to the virtual imaging surface 810 along the direction ofthe angle θb.

Processing for summing the first focus detection signal and the secondfocus detection signal subjected to translational movement.

Translational movement of the first focus detection signal A_(i) to thevirtual imaging surface 810 along the direction of the angle θacorresponds to +0.5 pixel shift in the column direction. Translationalmovement of the second focus detection signal B_(i) to the virtualimaging surface 810 along the direction of the angle θb corresponds to−0.5 pixel shift in the column direction. Thus, the first focusdetection signal A_(i) and the second focus detection signal B_(i) arerelatively shifted by +1 pixel, and then A_(i) and B_(i+1) arecorrespondingly summed, so that the refocus signal on the virtualimaging surface 810 can be generated. Likewise, the first focusdetection signal A_(i) and the second focus detection signal B_(i) aresummed by the integer pixel shift, so that a shift summation signal(refocus signal) on each virtual imaging surface corresponding to theinteger shift amount can be generated. A contrast evaluation value iscalculated from the generated shift summation signal (refocus signal).The MTF peak position of the imaging signal is calculated from thecalculated contrast evaluation value to thereby perform the second focusdetection of the refocus type.

A description will be given of the flow of second focus detectionprocessing with reference to the flowchart shown in FIG. 12. Theprocessing is performed by a focus detection signal generating unitwhich is realized by controlling the imaging element 107 and the imageprocessing circuit 125 in accordance with the program executed by theCPU 121.

In step S210, the processing for setting a focus detection area isperformed for focus adjustment within an effective pixel area of theimaging element 107. In the focus detection area, the focus detectionsignal generating unit generates a first focus detection signal from thelight-receiving signal (image-A signal) of the first focus detectingpixel, and generates a second focus detection signal from thelight-receiving signal (image-B signal) of the second focus detectingpixel. In step S220, summation processing for summing three pixels inthe column direction for each of the first focus detection signal andthe second focus detection signal is performed in order to suppress thesignal data amount. Furthermore, the Bayer (RGB) summation processing isperformed for converting an RGB signal into a brightness signal Y. Thesetwo summation processings are combinedly referred to as “second pixelsummation processing”. Note that one of either 3-pixel summationprocessing or Bayer (RGB) summation processing or both summationprocessings may be omitted.

In step S230, the second filter processing is performed for the firstfocus detection signal and the second focus detection signal. Thepassband of the second filter processing is illustrated in the graph gcshown by the broken line and the graph gd shown by the dotted line inFIG. 8. In the present embodiment, focus detection is performed from thesmall-defocus state to the vicinity of the best in-focus position by thesecond focus detection of the refocus type. Thus, the filtercharacteristics are set such that the passband of the second filterprocessing includes a higher frequency band than the passband of thefirst filter processing. If required, a Laplacian-type (second orderderivative type) [1, −2, 1] filter may also be used for edge extractionof an object imaging signal by the second filter processing. In thiscase, as shown by the graph gd shown by the dotted line in FIG. 8, thepassband of the second filter processing can be set to a higherfrequency band. The second focus detection is performed by extractingthe high frequency component of the object image, resulting in animprovement in focus detection accuracy.

In step S240 in FIG. 12, the second shift processing for relativelyshifting the first focus detection signal and the second focus detectionsignal obtained after the first filter processing in the pupil divisiondirection is performed and the resulting signals are summed to therebygenerate a shift summation signal (refocus signal). In step S240, theprocessing for calculating a contrast evaluation value (secondevaluation value) from the generated shift summation signal is furtherperformed. The kth first focus detection signal obtained after thesecond filter processing is denoted by A(k) and the kth second focusdetection signal obtained after the second filter processing is denotedby B(k). The range of the number k corresponding to the focus detectionarea is denoted by W. Given that the shift amount by the second shiftprocessing is denoted by s₂ and its range (shift range) is denoted byΓ2, a contrast evaluation value (second evaluation value) RFCON iscalculated by Formula (2):

$\begin{matrix}\left\lbrack {{Formula}\mspace{14mu} 2} \right\rbrack & \; \\{{{{RFCON}\left( s_{2} \right)} = {\max\limits_{k \in W}{{{A(k)} + {B\left( {k - s_{2}} \right)}}}}},{s_{2} \in {\Gamma 2}}} & (2)\end{matrix}$

As a result of the second shift processing by the shift amount s₂, ashift summation signal is generated by correspondingly summing the kthfirst focus detection signal A(k) and the “k−s₂”th second focusdetection signal B(k−s₂). An absolute value of the generated shiftsummation signal is calculated, and the maximum value is taken in therange W corresponding to the focus detection area, so that RFCON (s₂) iscalculated as a contrast evaluation value (second evaluation value). Ifrequired, a contrast evaluation value (second evaluation value)calculated for each row may be summed over a plurality of rows for eachshift amount.

In step S250, the processing for calculating a real value shift amountby which the contrast evaluation value becomes a maximum value isexecuted by sub-pixel computation based on the contrast evaluation value(second evaluation value) calculated in step S240 to thereby calculate apeak shift amount p2. The peak shift amount p2 is multiplied by thesecond conversion coefficient K2 corresponding to the image height ofthe focus detection area, the F-number of the imaging lens (focusingoptical system), and the exit pupil distance to thereby calculate thesecond detection amount (Def2). If required, the value of the secondconversion coefficient K2 may be the same as that of the firstconversion coefficient K1.

As described above, in the second focus detection of the refocus type,the second filter processing and the second shift processing areperformed for the first focus detection signal and the second focusdetection signal, and then the resulting signals are summed to generatea shift summation signal. A contrast evaluation value is calculated fromthe generated shift summation signal, and then the second detectionamount (Def2) is calculated from the contrast evaluation value.

In the imaging element 107 of the present embodiment, the resultobtained by summing light received by the first focus detecting pixeland light received by the second focus detecting pixel becomes lightreceived by the imaging pixel as shown in FIGS. 4, 5A, and 5B. Incontrast to the first focus detection of the phase difference type, inthe second focus detection of the refocus type, focus detection isperformed by a shift summation signal (refocus signal) of the firstfocus detection signal and the second focus detection signal. Thus,light corresponding to the shift summation signal used in the secondfocus detection substantially matches light corresponding to the imagingsignal. The shift summation signal and the imaging signal may besubstantially identically affected by the aberrations (sphericalaberration, astigmatism, coma aberration, and the like) of the focusingoptical system. Thus, the detected in-focus position (position where thesecond detection amount becomes 0) calculated by the second focusdetection of the refocus type substantially matches the best in-focusposition of the imaging signal (the MTF peak position of the imagingsignal). In other words, the second focus detection of the refocus typeis relatively highly accurate as compared with the first focus detectionof the phase difference type.

The first focus detection signal (broken line) and the second focusdetection signal (solid line) subjected to the second filter processingare shown in FIG. 13A by taking an example of the first focus detectionsignal (broken line) and the second focus detection signal (solid line)at the best in-focus position of the imaging signal at the peripheralimage height of the imaging element shown in FIG. 9A. A pixel address isplotted on the horizontal axis and a signal level is plotted on thevertical axis. A shift summation signal (refocus signal) obtained bysumming the first focus detection signal (broken line) and the secondfocus detection signal (solid line) subjected to the second filterprocessing by relatively shifting the signals by the shift amount of −2,−1, 0, 1, and 2 is shown in FIG. 13B. It can be seen that the peak valueof the shift summation signal varies with a change in shift amount. Acontrast evaluation value (second evaluation value) calculated from theshift summation signals is shown in FIG. 14. A shift amount is plottedon the horizontal axis and a contrast evaluation value is plotted on thevertical axis.

FIG. 10 illustrates the second detection amount (see the graph g2 shownby a solid line) by the second focus detection of the refocus typeaccording to the present embodiment. The first focus detection signaland the second focus detection signal shown in FIG. 9A are the firstfocus detection signal and the second focus detection signal obtainedwhen the set defocus amount shown in FIG. 10 is 0 [mm]. Since the seconddetection amount by the second focus detection is suppressed to lessthan the first detection amount by the first focus detection at the bestin-focus position where the set defocus amount is zero, it can be seenthat focus detection can be performed with high accuracy. In otherwords, the second focus detection of the refocus type achieves highdetection accuracy as compared with the first focus detection of thephase difference type in the vicinity of the best in-focus positionwhere the set defocus amount of the focusing optical system is zero.

On the other hand, since the refocusable range is limited, the range ofthe defocus amount which can be focus-detected by the second focusdetection of the refocus type with high accuracy is limited. Adescription will be given of the refocusable range in the presentembodiment with reference to FIG. 15. Given that the allowable confusioncircle diameter is denoted by δ and the F-number of the focusing opticalsystem is denoted by F, a depth of field at the F-number F is ±F×δ. Incontrast, the effective F-number F₀₁ (or F₀₂) in the horizontaldirection of the partial pupil area 501 (or 502) which is narrowed bybeing divided into N_(H)×N_(V) (e.g., 2×1) becomes darken by F₀₁=N_(H)×F(or F₀₂=N_(H)×F). An effective depth of field for each first focusdetection signal (or second focus detection signal) becomes N_(H) timesdeep by ±N_(H)×F×δ, and the in-focus range is spread over N_(H) times.An object image which is in-focus for each first focus detection signal(or second focus detection signal) is acquired within the range of theeffective depth of field “±N_(H)×F×δ”. Thus, the in-focus position canbe re-adjusted (refocus) after shooting by the refocus processing fortranslationally moving the first focus detection signal (or second focusdetection signal) along the chief ray angle θa (or θb) shown in FIG. 11.

The defocus amount d from the imaging plane, which can be re-adjusted tothe in-focus position after shooting, is limited. The refocusable rangeof the defocus amount d is generally in the range of Formula (3):[Formula 3]|d|≦N _(H) ×F×δ  (3)

The allowable confusion circle diameter δ is defined by δ=2·ΔX(reciprocal of the Nyquist frequency 1/(2·ΔX) of the pixel cycle ΔX) orthe like. If required, the allowable confusion circle diameter may beused as δ=2·ΔX_(AF) from the reciprocal of the Nyquist frequency1/(2·ΔX_(AF)) of the cycle ΔX_(AF) (=M·ΔX: in the case of M pixelsummation) of the first focus detection signal (or second focusdetection signal) obtained after the second pixel summation processing.

The range of the defocus amount which can be detected with high accuracyby the second focus detection of the refocus type is generally limitedin the range of Formula (3). The defocus range which can be detected bythe second focus detection with high accuracy is equal to or less thanthe defocus range which can be detected by the first focus detection ofthe phase difference type. As shown in FIG. 5B, the relative shiftamount between the first focus detection signal and the second focusdetection signal in the horizontal direction is substantiallyproportional to the defocus amount therebetween.

The present embodiment is based on the first focus detection forperforming a focus adjustment from the large-defocus state to thesmall-defocus state of the focusing optical system and the second focusdetection for performing a focus adjustment from the small-defocus stateof the focusing optical system to the vicinity of the best in-focusposition. The passband of the second filter processing in the secondfocus detection includes a higher frequency band than the passband ofthe first filter processing in the first focus detection. The number ofpixels summed by the second pixel summation processing in the secondfocus detection is equal to or less than the number of pixels summed bythe first pixel summation processing in the first focus detection.

As described above, if the F-number of the focusing optical system isequal to or less than a predetermined F-number, the focus detectionaccuracy of the first focus detection of the phase difference type maydeteriorate. Thus, if required, if the F-number of the focusing opticalsystem is equal to or less than a predetermined F-number, the firstfocus detection of the phase difference type and the second focusdetection of the refocus type are used. In other words, highly-accuratefocus detection can be realized by using the second detection amount.

Next, a description will be given of focus detection processing when asaturated pixel is included. If the image area (AF area) targeted forfocus detection includes a saturated pixel, the accuracy of the seconddetection amount in the second focus detection may become lower than theaccuracy of the first detection amount by the first focus detection.This occurs because a shift summation signal is saturated when theoutput of a saturated pixel is included in a portion of signals to besubject to shift summation upon second focus detection, which results ina state of no gradation (no contrast) of brightness. FIG. 16A is a viewcomparatively illustrating the first focus detection signal (solid line)and the second focus detection signal (broken line) in the state (I)including a saturated pixel signal and the state (II) without includinga saturated pixel signal. A pixel address corresponding to a pixelposition is plotted on the horizontal axis and a signal level is plottedon the vertical axis. Both signals have waveforms which mutually matchby the 2-bit shift amount of movement.

FIG. 16B is a diagram illustrating a shift summation signal obtained bysummation after shift processing for the first focus detection signaland the second focus detection signal shown in FIG. 16A. The state (I)including a saturated pixel signal is shown on the left side of FIG. 16Band the state (II) without including a saturated pixel signal is shownon the right side of FIG. 16B. FIG. 16C is a plot diagram of a maximumvalue (so-called “contrast evaluation value”) of the shift summationsignal shown in FIG. 16B subjected to differentiation processing underthe shift conditions. A bit shift amount is plotted on the horizontalaxis and a contrast evaluation value is plotted on the vertical axis.The state (I) including a saturated pixel signal is shown on the leftside of FIG. 16C and the state (II) without including a saturated pixelsignal is shown on the right side of FIG. 16C. In the state (II), thereis a peak in the contrast evaluation value in the 2-bit shift state (see“−2” on the horizontal axis of FIG. 16C). However, in the state (I),there is no peak in the 2-bit shift state (see “−2” on the horizontalaxis of FIG. 160) at which there should be a peak. Thus, the bestin-focus position cannot be correctly detected. Accordingly, in thepresent embodiment, the following focus detection processing isperformed under a condition including a saturated signal.

FIG. 17 is a flowchart illustrating the flow of focus detectionprocessing according to the present embodiment. The processing isrealized by a program executed by the CPU 121.

In the present embodiment, the content of focus detection processing ischanged between the case where the number of focus detecting pixelswhich have detected saturation of the output exceeds a threshold valueand the case where the number of focus detecting pixels is equal to orless than a threshold value. For example, if the number of saturationlines (denoted by “SL”) is equal to or less than a predetermined number,the focus lens is driven based on the result of the first focusdetection of the phase difference type until an absolute value of thedefocus amount of the focusing optical system is equal to or less than apredetermined value 1 (first threshold value). In this manner, a focusadjustment operation is performed from the large-defocus state to thesmall-defocus state of the focusing optical system. Then, the focus lensis driven based on the result of the second focus detection of therefocus type until an absolute value of the defocus amount of thefocusing optical system is equal to or less than a predetermined value 2(second threshold value where “the predetermined value 2<thepredetermined value 1”). In this manner, a focus adjustment operation isperformed from the small-defocus state to the vicinity of the bestin-focus position of the focusing optical system. If the number ofsaturation lines SL is larger than a predetermined number, the focuslens is driven based on the result of the first focus detection of thephase difference type until an absolute value of the defocus amount ofthe focusing optical system is equal to or less than the predeterminedvalue 1. In this manner, a focus adjustment operation is performed fromthe large-defocus state to the small-defocus state of the focusingoptical system. Then, third filter processing is performed by changingthe passband of the first filter processing in the first focusdetection. In the third filter processing, computation processing isexecuted by using a filter having a high passband equivalent to thepassband of the second filter processing in the second focus detection.The first focus detection is performed again by changing the passband,and then the focus lens is driven based on the result of the first focusdetection of the phase difference type until an absolute value of thedefocus amount of the focusing optical system is equal to or less than apredetermined value 3 (third threshold value where “the predeterminedvalue 3<the predetermined value 1”). In this manner, a focus adjustmentoperation is executed from the small-defocus state to the furthersmall-defocus state of the focusing optical system.

Upon start of the processing in FIG. 17, the saturation detecting unit1211 counts the number of saturation lines SL of a captured image instep S010. At this time, the range of the number of saturation lines SLcounted by the saturation detecting unit 1211 may be limited within theset AF range. Note that a saturation line indicates a row including asaturated pixel. In step S011, the number of saturation lines SL iscompared with a predetermined number (denoted by “SL1”). If the numberof saturation lines SL counted in step S010 is greater than thepredetermined number of saturation lines SL1 which may adversely affecton the AF result, the processing proceeds to step S100. If the number ofsaturation lines SL counted in step S010 is equal to or less than thepredetermined number of saturation lines SL1, the processing proceeds tostep S104.

If the judging condition in step S012 is not met, the processing insteps S100 and S101 is executed as iteration processing. In step S100,the first detection amount (Def1) is detected based on the result of thefirst focus detection of the phase difference type. In step S012, themagnitude |Def1| of the first detection amount (Def1) is compared withthe predetermined value 1. If |Def1| is greater than the predeterminedvalue 1, the processing proceeds to step S101, whereas if |Def1| isequal to or less than the predetermined value 1, the processing shiftsto step S013. In step S101, the focus lens is driven in accordance withthe first detection amount (Def1), and the processing returns to stepS100.

In step S013, filter band change processing is executed. As the thirdfilter processing to be used upon later detection of the first detectionamount again, the processing for changing the passband of the firstfilter processing in the first focus detection to a high passbandequivalent to the passband of the second filter processing in the secondfocus detection is performed. By increasing the passband of the firstfilter processing in the small-defocus state, a focus adjustment can bemade from the small-defocus state to the further small-defocus state ofthe focusing optical system.

If the judging condition in step S014 is not met, the processing insteps S102 and S103 is executed as iteration processing. In step S102,the first detection amount (Def1) is detected based on the first focusdetection of the phase difference type. In step S014, the magnitude|Def1| of the first detection amount (Def1) is compared with thepredetermined value 3 (<the predetermined value 1). If |Def1| is greaterthan the predetermined value 3, the processing proceeds to step S103,whereas if |Def1| is equal to or less than the predetermined value 3,the focus adjustment operation ends. In step S103, the focus lens isdriven in accordance with the first detection amount (Def1), and theprocessing returns to step S102.

If the judging condition in step S015 is not met, the processing insteps S104 and S105 is executed as iteration processing. In step S104,the first detection amount (Def1) is detected based on the first focusdetection of the phase difference type. In step S015, the magnitude|Def1| of the first detection amount (Def1) is compared with thepredetermined value 1. If |Def1| is greater than the predetermined value1, the processing proceeds to step S105, whereas if |Def1| is equal toor less than the predetermined value 1, the processing shifts to stepS200. In step S105, the focus lens is driven in accordance with thefirst detection amount (Def1), and the processing returns to step S104.

If the judging condition in step S016 is not met, the processing insteps S200 and S201 is executed as iteration processing. In step S200,the second detection amount (Def2) is detected based on the result ofthe second focus detection of the refocus type. In step S016, themagnitude |Def2| of the second detection amount (Def2) is compared withthe predetermined value 2 (<the predetermined value 1). If |Def2| isgreater than the predetermined value 2, the processing proceeds to stepS201, whereas if |Def2| is equal to or less than the predetermined value2, the focus adjustment operation ends. In step S201, the focus lens isdriven in accordance with the second detection amount (Def2), and theprocessing returns to step S200.

By executing the above processing, highly-accurate focus detection canbe achieved even under a condition including a saturation line which maycause a deterioration in accuracy of the second detection amount in thesecond focus detection.

Next, a description will be given of focus detection processing in thecase of low brightness. If the object brightness is low, the accuracy ofthe second detection amount in the second focus detection maydeteriorate as compared with the accuracy of the first detection amountby the first focus detection. In the second focus detection, a secondevaluation value is calculated by the edge extraction of shift summationsignals. If the S/N ratio (signal-to-noise ratio) lowers under a lowbrightness condition, a peak caused by a shot noise or the like may beerroneously determined to be high contrast. In the present embodiment, acountermeasure is taken by the following processing.

FIG. 18 is a flowchart illustrating the flow of focus detectionprocessing according to the present embodiment. The processing isrealized by a program executed by the CPU 121.

If the object brightness is equal to or greater than a predeterminedthreshold value, the focus lens is driven based on the result of thefirst focus detection of the phase difference type until an absolutevalue of the defocus amount of the focusing optical system is equal toor less than the first threshold value (the predetermined value 1). Inthis manner, a focus adjustment operation is performed from thelarge-defocus state to the small-defocus state of the focusing opticalsystem. Then, the focus lens is driven based on the result of the secondfocus detection of the refocus type until an absolute value of thedefocus amount of the focusing optical system is equal to or less thanthe predetermined value 2 (<the predetermined value 1) which is thesecond threshold value. In this manner, a focus adjustment operation isperformed from the small-defocus state to the vicinity of the bestin-focus position of the focusing optical system. If the objectbrightness is less than a predetermined threshold value, the focus lensis driven based on the result of the first focus detection of the phasedifference type until an absolute value of the defocus amount of thefocusing optical system is equal to or less than the predeterminedvalue 1. A focus adjustment operation is performed from thelarge-defocus state to the small-defocus state of the focusing opticalsystem. Then, focus adjustment is completed without performing thesecond focus detection.

In step S300, the brightness detecting unit 1212 detects the objectbrightness (denoted by “Lv”) of a captured image. The range fordetecting the object brightness may be limited within the set AF range.In step S301, the object brightness Lv detected in step S300 is comparedwith a predetermined brightness level (denoted by “Lv1”). If the objectbrightness Lv is less than the brightness level Lv1 which may adverselyaffect on the AF result, the processing proceeds to step S400, whereasif the object brightness Lv is equal to or greater than the brightnesslevel Lv1, the processing proceeds to step S402.

If the judging condition in step S302 is not met, the processing insteps S400 and S401 is executed as iteration processing. In step S400,the first detection amount (Def1) is detected based on the result of thefirst focus detection of the phase difference type. In step S302, themagnitude |Def1| of the first detection amount (Def1) is compared withthe predetermined value 1. If |Def1| is greater than the predeterminedvalue 1, the processing proceeds to step S401, whereas if |Def1| isequal to or less than the predetermined value 1, the focus adjustmentoperation ends. In step S401, the focus lens is driven in accordancewith the first defocus amount (Def1), and the processing returns to stepS400.

If the judging condition in step S303 is not met, the processing insteps S402 and S403 is executed as iteration processing. In step S402,the first detection amount (Def1) is detected based on the result of thefirst focus detection of the phase difference type. In step S303, themagnitude |Def1| of the first detection amount (Def1) is compared withthe predetermined value 1. If |Def1| is greater than the predeterminedvalue 1, the processing proceeds to step S403, whereas if |Def1| isequal to or less than the predetermined value 1, the processing shiftsto step S500. In step S403, the focus lens is driven in accordance withthe first detection amount (Def1), and the processing returns to stepS402.

If the judging condition in step S304 is not met, the processing insteps S500 and S501 is executed as iteration processing. In step S500,the second detection amount (Def2) is detected based on the result ofthe second focus detection of the refocus type. In step S304, themagnitude |Def2| of the second detection amount (Def2) is compared withthe predetermined value 2 (<the predetermined value 1). If |Def2| isgreater than the predetermined value 2, the processing proceeds to stepS501, whereas if |Def2| is equal to or less than the predetermined value2, the focus adjustment operation ends. In step S501, the focus lens isdriven in accordance with the second detection amount (Def2), and theprocessing returns to step S500.

As described above, the content of focus detection processing is changedbased on the comparison result between the object brightness Lv and Lv1(threshold value). The reason why the focus adjustment operation ends instep S302 when the magnitude |Def1| of the first detection amount (Def1)is equal to or less than the predetermined value 1 is to avoid anadverse effect of a low brightness condition on the second focusdetection. At this point, the defocus amount still remains as comparedwith the best in-focus position to be reached after the processing instep S501. However, it can be determined that the best in-focus positionhas been reached under a low brightness condition, and thus, the focusadjustment operation ends when the judging condition in step S302 hasbeen met. In contrast to the processing under the presence of asaturated signal described with reference to FIG. 17, the processingshown in FIG. 18 does not increase the filter passband. This is becausehigh-frequency information included in an imaging signal under a lowbrightness condition is mainly a noise and thus low-frequency signaldetection is rather effective. In the present embodiment, a focusadjustment operation to the final best in-focus position can beperformed even under a low brightness condition which may cause adeterioration in accuracy of the second detection amount in the secondfocus detection.

According to the present embodiment, a focus state can be detected withaccuracy by the sequence taking into account a condition which may causea reduction in focus detection accuracy by the contrast evaluating unit,such as a condition of shooting a low-brightness object or including asaturated pixel.

Second Embodiment

Next, a description will be given of a second embodiment of the presentinvention. In the second embodiment, the same reference numerals alreadyused are used for the same components as those in the first embodiment,and thus, a detailed description thereof will be omitted. Hereinafter, adescription will be given of focus detection processing which isdifferent from the first embodiment.

A description will be given of the focus detection processing when asaturated signal is included with reference to the flowchart shown inFIG. 19. The processing is realized by a program executed by the CPU121.

In the present embodiment, the first focus detection of the phasedifference type is performed until an absolute value of the defocusamount of the focusing optical system is equal to or less than thepredetermined value 1 to thereby drive the focus lens. In this manner, afocus adjustment operation is performed from the large-defocus state tothe small-defocus state of the focusing optical system. Then, the firstdetection amount and the second detection amount are weighted inaccordance with the number of saturation lines SL to thereby generate athird detection defocus amount (hereinafter referred to as “thirddetection amount” which is denoted by “Def3”). A focus adjustmentoperation is performed until an absolute value of the generated thirddetection amount is equal to or less than the predetermined value 4(<the predetermined value 1).

In step S600, the saturation detecting unit 1211 counts the number ofsaturation lines SL of a captured image. The processing is the same asthat in step S010 shown in FIG. 17 but does not include the judgmentprocessing in step S011, and the processing shifts to step S700. If thejudging condition in step S701 is not met, the processing in steps S700and S702 is executed as iteration processing. In step S700, the firstdetection amount (Def1) is detected based on the result of the firstfocus detection of the phase difference type. If it is determined by thejudgment processing in step S701 that the magnitude |Def1| of the firstdetection amount (Def1) is greater than the predetermined value 1, theprocessing proceeds to step S702, whereas if |Def1| is equal to or lessthan the predetermined value 1, the processing proceeds to step S601. Instep S702, the focus lens is driven in accordance with the firstdetection amount (Def1), and the processing returns to step S700.

As in step S013 shown in FIG. 17, filter band change processing isexecuted in step S601. In other words, in order to perform the thirdfilter processing, the passband of the first filter processing in thefirst focus detection is set to a high-frequency equivalent to thepassband of the second filter processing in the second focus detection.After step S601, the parallel processing in steps S800 and S801 isexecuted. In step S800, the first detection amount (Deft) is obtainedfrom the result of the first focus detection of the phase differencetype. In step S801, the second detection amount (Def2) is obtained fromthe result of the second focus detection of the refocus type. After theprocessing in steps S800 and S801, the processing proceeds to step S802,and the third detection amount (Def3) is calculated. The third detectionamount (Def3) is calculated by the weighted average computation of thefirst detection amount (Def1) obtained in step S800 and the seconddetection amount (Def2) obtained in step S801 (Def3 composition). Aweighted coefficient to be used upon weighted average computation isdetermined by the number of saturation lines SL detected in step S600.In other words, in the weighted average processing for calculating thethird detection amount (Def3), the weighted value, i.e., the weightedcoefficient value for the first detection amount (Def1) is set to belarge with an increase in the value of the number of saturation lines SLdetected in step S600. The reason for this is that a proportion occupiedby the second detection amount is set to be small relative to thatoccupied by the first detection amount because of a reduction in theaccuracy of the second detection amount in the second focus detectionwhen there are many saturated signals.

In step S803, the magnitude |Def3| of the third detection amount whichis the computation result of weighted average processing is comparedwith a predetermined value 4 (<the predetermined value 1). If |Def3| isgreater than the predetermined value 4, the processing proceeds to stepS804, whereas if |Def3| is equal to or less than the predetermined value4, the focus adjustment operation ends. In step S804, the focus lens isdriven in accordance with the third detection amount (Def3). If thejudging condition in step S803 is not met, the processing in steps S800,S801, S802, and step S804 is executed as iteration processing.

In the present embodiment, highly-accurate focus detection can beachieved even under a condition including a saturation line which maycause a deterioration in accuracy of the second detection amount in thesecond focus detection.

Next, a description will be given of focus detection processing in thecase of low brightness with reference to the flowchart shown in FIG. 20.The processing is realized by a program executed by the CPU 121.

In the present embodiment, the first focus detection of the phasedifference type is performed until an absolute value of the defocusamount of the focusing optical system is equal to or less than thepredetermined value 1 to thereby drive the focus lens. In this manner, afocus adjustment operation is performed from the large-defocus state tothe small-defocus state of the focusing optical system. Then, a fourthdetection defocus amount (Def4) is calculated in accordance with theobject brightness Lv. The fourth detection defocus amount (Def4) isgenerated by the weighting processing using the first detection amountand the second detection amount. A focus adjustment operation isperformed using the fourth detection defocus amount until an absolutevalue of the defocus amount of the focusing optical system is equal toor less than a predetermined value 5 (<the predetermined value 1).

As in step S300 shown in FIG. 18, the brightness detecting unit 1212detects the object brightness Lv of a captured image in step S610. Ifthe judging condition “|Def1|≦the predetermined value 1” is not met instep S711, the processing in steps S710 and S712 is executed asiteration processing. The first focus detection in step S710 and thelens drive processing in step S712 are the same as those in step S700and step S702, respectively, in FIG. 19, and thus, explanation thereofwill be omitted.

If the magnitude |Def1| of the first detection amount (Def1) is equal toor less than the predetermined value 1 in step S711, the processingproceeds to the parallel processing in steps S810 and S811. As in stepS800 shown in FIG. 19, the first detection amount (Def1) is calculatedbased on the result of the first focus detection of the phase differencetype in step S810. As in step S801 shown in FIG. 19, the seconddetection amount (Def2) is calculated based on the result of the secondfocus detection of the refocus type in step S811. After steps S810 andS811, the processing proceeds to step S812.

In step S812, the fourth detection defocus amount (Def4) is calculated.In other words, the weighted average computation of the first detectionamount (Def1) and the second detection amount (Def2) is executed (Def4composition). A weighted coefficient to be used upon weighted averagecomputation is determined by the object brightness Lv detected in stepS610. In the weighted average processing, the weighted value, i.e., theweighted coefficient value for the first detection amount (Def1) is setto be large with a decrease in the object brightness Lv. The reason forthis is that a proportion occupied by the second detection amount is setto be small relative to that occupied by the first detection amountbecause of a reduction in the accuracy of the second detection amount inthe second focus detection when the object brightness is low.

In the judgment processing in step S813, the magnitude |Def4| of thefourth detection defocus amount is compared with the predetermined value5 (<the predetermined value 1). If |Def4| is greater than thepredetermined value 5, the processing proceeds to step S814, whereas if|Def4| is equal to or less than the predetermined value 5, the focusadjustment operation ends.

In step S814, the focus lens is driven in accordance with the firstdetection amount (Def3). If the judging condition in step S813 is notmet, the processing in steps S810, S811, S812, and S814 is executed asiteration processing.

In the present embodiment, a focus adjustment operation to the finalbest in-focus position can be performed even under a low brightnesscondition which may cause a deterioration in accuracy of the seconddetection amount in the second focus detection, i.e., under a lowbrightness condition.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2014-001065, filed on Jan. 7, 2014, which is hereby incorporated byreference herein in its entirety.

What is claimed is:
 1. An imaging apparatus comprising: an imagingdevice that outputs a parallax image of a first image signal and asecond image signal; a first focus detecting unit configured tocalculate a defocus amount by a phase-difference detection method usingthe first signal and the second image signal; a second focus detectingunit configured to calculate a contrast evaluation value based on acombined signal, wherein the combined signal is a signal obtained byrelatively shifting phases of the first and second image signals andcombining the first and second image signals; and a saturation detectingunit configured to detect saturated pixel signal of the first and secondimage signals, and a control unit configured to, when a number of thesaturated pixel signals detected by the saturation detecting unit is afirst value, control a focus adjustment operation using a result of thefirst focus detecting unit, whereas when the number of the saturatedpixel signals detected by the saturation detecting unit is a secondvalue which is less than the first value, the control unit controls thefocus adjustment operation using the result of the first focus detectingunit and a result of the second focus detecting unit.
 2. The imagingapparatus according to claim 1, wherein the imaging device has aplurality of focus detecting pixels for receiving light passing throughdifferent partial pupil areas of a focusing optical system, wherein thefirst image signal is output from a first focus detecting pixel forreceiving light passing through a first partial pupil area of thefocusing optical system, and the second image single is output from asecond focus detecting pixel for receiving light passing through asecond partial pupil area, which is different from the first partialpupil area.
 3. The imaging apparatus according to claim 1, wherein, whenthe number of the saturated pixel signals detected by the saturationdetecting unit is the first value, the first focus detecting unitcalculates a defocus amount using signals processed by a filterprocessing of which a passband is higher than in a case where the numberof the saturated pixel signals detected by the saturation detecting unitis the second value.
 4. The imaging apparatus according to claim 1,wherein the control unit is configured to, when the number of thesaturated pixel signals detected by the saturation detecting unitexceeds a threshold value, control the focus adjustment operation usingthe result of the first focus detecting unit, whereas when the number ofthe saturated pixel signals detected by the saturation detecting unit isequal to or less than the threshold value, the control unit controls thefocus adjustment operation using the results of the first and secondfocus detecting units.
 5. The imaging apparatus according to claim 1,wherein the control unit is configured to control the focus adjustmentoperation without the result of the second focus detecting unit.
 6. Acontrol method executed by an imaging apparatus comprising an imagingthat outputs a parallax image of a first image signal and a second imagesignal and a control unit configured to control a focus adjustmentoperation using the parallax image, the method comprising: detecting, bya saturation detecting unit, saturated pixels of the parallax image;calculating, by a first focus detecting unit, a correlation amount byperforming first filter processing and first shift processing to theparallax image and determining a first detection amount from thecorrelation amount when a number of the saturated pixels detected by thesaturation detecting unit exceeds a threshold value, and then thecontrol unit controls a focus adjustment operation using the firstdetection amount; and calculating, by the first focus detecting unit, acorrelation amount by performing first filter processing and first shiftprocessing to the parallax image and determining the first detectionamount from the correlation amount when the number of the saturatedpixels detected by the saturation detecting unit is equal to or lessthan the threshold value, and calculating, by a second focus detectingunit, a contrast evaluation value by generating a shift summation signalobtained by the summation of second filter processing and second shiftprocessing to the parallax image and determining a second detectionamount obtained from the contrast evaluation value after the controlunit controls the focus adjustment operation using the first detectionamount, and then the control unit controls the focus adjustmentoperation using the second detection amount.